import fetch from '@/utils/network/fetch'

const getTrainees = objc => {
    fetch('/api/trainee', objc)
}

const addTrainee = objc => {
    fetch('/api/trainee', objc)
}

const removeTrainee = objc => {
    fetch('/api/trainee/deletion', objc)
}

const editTrainee = objc => {
    fetch(`/api/trainee/${objc.data.employeeId}`, objc)
}

const updateBySelf = objc => {
    fetch('/api/trainee/self', objc)
}

const resetTraineePassword = (data, objc) => {
    data.employeeId && data &&
        fetch(`/api/trainee/${data.employeeId}`, {
            ...objc,
            method: 'put',
            data
        })
}

const uploadTraineeTemplete = (objc = {}) => {
    fetch('/api/trainee/import/templete', objc)
}

export default {
    getTrainees,
    addTrainee,
    removeTrainee,
    editTrainee,
    resetTraineePassword,
    updateBySelf,
    uploadTraineeTemplete
}
